export const getIsPhone = state => state.isPhone 
export const getCurrentCart = state => state.cart
export const getLotteryType = state => state.lotteryType
export const getCurrentMainTab = state => state.currentMainTab
export const getCurrentTab = state => state.currentTab
export const getCurrentMainId = state => state.mainTabCurrendId
export const getCurrentSubTab = state => state.subTabCurrentTab
export const getCurrentSubId = state => state.currentSubId
export const getLotteryDateNo = state => state.lotteryDateNo
export const getCurrentComponent = state => state.currentComponent
export const getUnitPrice = state => state.unitPrice
export const getUnitRate = state => state.unit
export const getSingleAmount = state => state.singleAmount
export const getTotalAmount = state => state.totalAmount
export const getRefundRate = state => state.refundRate
export const getBuyingQuantity = state => state.buyingQuantity
export const getSelectedNumbers = state => state.selectedNumbers
export const getRadioSelectorIndex = state => state.activeRadioSelectorIndex
export const getCurrentLotteryState = state => {
  let currentLotteryState = []
  let lotteryId = state.lotteryType.id 
  let mainTabId = state.currentMainTab.id
  let subTabId = state.currentTab.id
  console.log(lotteryId, mainTabId, subTabId)
  currentLotteryState = state.lotteryOptionsData[lotteryId][mainTabId][subTabId].data
  return currentLotteryState 
}
export const getShowMoneyInput = state => {
  let lotteryId = state.lotteryType.id 
  let mainTabId = state.currentMainTab.id
  let subTabId = state.currentTab.id
  return state.lotteryOptionsData[lotteryId][mainTabId][subTabId].showMoneyInput
}
export const getShowRadioSelector = state => {
  let lotteryId = state.lotteryType.id 
  let mainTabId = state.currentMainTab.id
  let subTabId = state.currentTab.id
  return state.lotteryOptionsData[lotteryId][mainTabId][subTabId].showRadioSelector
}
export const getLotteryAmount = state => {
  return state.unitPrice * state.buyingQuantity * state.unit
}
// 奖金
export const getBonous = state => {
  return getLotteryAmount(state) * state.refundRate
}
// 彩票号码提取数据
export const getSortedNumber = state => {
  let ret = []
  let arr = JSON.parse(JSON.stringify(state.lotteryNumbers))
  let numbers 
  let len = arr.length
  for (let i = 0; i < len; i++) {
    if (arr[i] == undefined) {
      continue;
    }
    arr[i].numbers.forEach(function(item) {
      ret.push(item)
    })
  }
  return ret.join(',')
}
// 获取选择彩票的全部信息
export const getCurrentLotteryInfo = state => {
  let info = {
    currentTab: state.currentTab,
    selectedNumbers: getSortedNumber(state),
    refundRate: state.refundRate,
    unitPrice: state.unitPrice,
    totalAmount: getLotteryAmount(state),
    bonous: getBonous(state)
  }
  return info
}
// 彩票选中状态
export const getBallSelectionState = state => state.ballSelectionState
export const getNumberPosition = state => state.numberPosition
// 遗漏 or 缺失
export const getParameterType = state => state.parameterType 

export const getSelectedTime = state => state.selectedTime
export const getUserInfo = state => state.user

// 手机

export const getShowSideSlider = state => state.showSideSlider
export const getShowSidePanel = state => state.showSidePanel